class Student {
    name: string
    age: number
    constructor(name: string, age: number) {
        this.name = name,
            this.age = age
    }
    getName(): void {
        console.log(this.name);
    }
    getAge(): void {
        console.log(this.age);
    }
}

var s: Student = new Student("lisi", 18);
s.getName();
s.getAge();